using System;
using System.IO;
using System.Windows;
using System.Text;
using System.Collections.Generic;
using Qplus.beans;


namespace Qplus.Commands
{

    /**
     * 
     *
     */
    public class SearchFriendCommand : AbsHeaderHttpCommand , HttpInputStreamProcessor{
	
	    const String COMMAND = "SearchFriend";
	
	    /**
	     * @param command
	     * @param uid
	     * @param UKEY
	     */
	    public SearchFriendCommand(String uid, String UKEY)
            : base(COMMAND, uid, UKEY)
        {
		    
	    }
	
	    /**
	     * @param command
	     * @param uid
	     * @param UKEY
	     */
	    public SearchFriendCommand(long uid, byte[] UKEY)
            : base(COMMAND, uid.GetType().ToString(), Encoding.UTF8.GetString(UKEY, 0, UKEY.Length))
        {
	
	    }

	    
	    public override Boolean processInputStream(Stream responseStream) {
            return true;
	    }
	
	    /**
	     * 
	     * @param userName用户昵称(模糊匹配)
	     * @param age(例如25-50 空字符串表示未设置)
	     * @param sex性别(0 表示未设置 1 男 2 女)
	     * @param pageNum页号
	     */
	    public void set(String userName, String age, int sex, int pageNum){
		    setUserName(userName);
		    setAge(age);
		    setSex(sex);
		    setPage(pageNum);
	    }

	    private void setUserName(String userName){
		    addParams("UserName", userName);
	    }
	
	    private void setAge(String age){
		    addParams("Age", age);
	    }
	
	    private void setSex(int sex){
		    addParams("Sex", sex);
	    }
	
	    private void setPage(int pageNum){
		    addParams("IndexPage", pageNum);
	    }

	    
	    public override void onSuccess(int code) {
	    }

	    
	    public override void onFailed(int code) {
	    }
	
	    public void onSearchResult(List<UserInfo> result){
		
	    }
	
	    public HttpTask execute(String url){
		    return base.execute(url, this);
	    }
    }
}
